'''
Created on Apr 5, 2009

@author: Administrator
'''
from django.db import models
from django.contrib.auth.models import User

class Company(models.Model):
    # not null properties
    name = models.CharField(max_length=20, null=False)
    type = models.CharField(max_length=20, null=False)
    address = models.CharField(max_length=200, null=False)
    postnum = models.CharField(max_length=20, null=False)
    phone = models.CharField(max_length=20, null=False)
    email = models.EmailField(max_length=75, null=False)
    introduction = models.TextField(max_length=4000, null=False)
    user = models.ForeignKey(User, null=False)
    
    # nullable properties
    faxno = models.CharField(max_length=20)
    homepage = models.CharField(max_length=200)
    
    def get_properties_tuple(self):
       return  {'name': self.name,
               'type': self.type,
               'address': self.address,
               'postnum': self.postnum,
               'phone': self.phone,
               'email': self.email,
               'introduction': self.introduction,
               'user': self.user,
               'faxno': self.faxno,
               'homepage': self.homepage, }
